<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
  <th:block th:include="include :: header('项目小试')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
  <form class="form-horizontal m" id="form-projectTest-edit" th:object="${projectTest}">
    <input name="testId" th:field="*{testId}" type="hidden">
    <input name="projectId" th:field="*{projectId}" type="hidden">
    <div class="form-group">
      <label class="col-sm-3 control-label">小试结果：</label>
      <div class="col-sm-5">
        <input name="testFile" type="file" accept="image/*">
      </div>
      <div class="col-sm-1">
        <div th:if="${projectTest.testUrl != null and projectTest.testUrl != ''}">
          <img class='img-circle img-xs' data-target='self' th:src="'/abvfile/small/'+${projectTest.testUrl}">
        </div>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-3 control-label">小试描述：</label>
      <div class="col-sm-8">
        <textarea name="testIntro" maxlength="255" class="form-control" rows="8">[[*{testIntro}]]</textarea>
      </div>
    </div>
  </form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
  var prefix = ctx + "project/projectTest";
  $("#form-projectTest-edit").validate({
    focusCleanup: true
  });

  function submitHandler() {
    if ($.validate.form()) {
      const formData = new FormData($("#form-projectTest-edit")[0]);
      $.ajax({
        url: prefix + "/edit",
        type: "post",
        data: formData,
        cache: false,
        processData: false,
        contentType: false,
        success: function(result) {
          $.operate.saveSuccess(result);
        }
      });
    }
  }
  $.form.imgView("#form-projectTest-edit");
</script>
</body>
</html>
